Expert GeoServer by Ben Mearns
Author:Ben Mearns
Language: eng
Format: epub
Publisher: Packt Publishing
Published: 2018-07-31T09:00:33+00:00
If the resource allocation is too high, it will cause an out-of-memory error and GeoServer will crash. If we set our parameters too low, although this may result in greater stability on the server, it can cause requests to drop or slow down.
The easiest way to alter the JVM settings shown in the preceding screenshot is to alter the JAVA_OPTS environment variable. In the following screenshot, you can see an echo of the JAVA_OPTS environment variable:
These may be some of the settings that we already set. By default, you probably won't see anything when you echo the environment variable. There are, however, some parameters. One is related to the minimum amount of memory (Xms128m) used by GeoServer or the JVM when you start them up. We can bump this up to add memory so that GeoServer isn't trying to allocate this as it runs into higher demand for resources. We can also set a maximum amount of memory (Xmx756M) that the JVM can grab, which can prevent an out-of-memory error. The SoftRefPolicy parameter is related to the amount of memory that we give to the reference, which is related to the cache. If we bump it up, we'll have more information stored in the cache, which of course enhances performance. The downside, however, is that we might run into an out-of-memory error again if it takes up too much memory in the cache.
The command in Windows for setting environment variables is setx. The following is an example of how to add a new parameter to the JAVA_OPTS environment variable. The UseParNewGC parameter involves garbage collection:
C:\Users\mearns>setx JAVA_OPTS "%JAVA_OPTS% --XX:+UseParNewGC"
There are a number of garbage collection options that you can use with the JVM. This one in particular involves multiple threads for doing garbage collection, concurrent with other requests that may be going on in your GeoServer instance. The benefit here is that GeoServer doesn't need to pause to carry out this action, and garbage collection of course frees up memory.
The control flow extension limits the number of concurrent operations, such as requests and threads. Control flow offers a similar kind of tuning challenge; hiring a resource allocation such as concurrent requests to provide greater memory will give us an out-of-memory crash, but too little memory will result in greater latency.
In addition to the usual extension installation process, the control flow extension requires a manually created controlflow.properties file under the data_dir directory. The content for this can be found on the control flow reference page on the GeoServer site (http://docs.geoserver.org/stable/en/user/extensions/controlflow/index.html), or you can use the sample that we've provided with the book:
# if a request waits in queue for more than 60 seconds it's not worth executing,
# the client will likely have given up by then
timeout=60
Download
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
Sapiens: A Brief History of Humankind by Yuval Noah Harari(14344)
The Tidewater Tales by John Barth(12639)
Mastermind: How to Think Like Sherlock Holmes by Maria Konnikova(7304)
Do No Harm Stories of Life, Death and Brain Surgery by Henry Marsh(6922)
The Thirst by Nesbo Jo(6906)
Why We Sleep: Unlocking the Power of Sleep and Dreams by Matthew Walker(6679)
Life 3.0: Being Human in the Age of Artificial Intelligence by Tegmark Max(5533)
Sapiens by Yuval Noah Harari(5344)
The Body: A Guide for Occupants by Bill Bryson(5065)
The Longevity Diet by Valter Longo(5048)
The Rules Do Not Apply by Ariel Levy(4933)
The Immortal Life of Henrietta Lacks by Rebecca Skloot(4564)
Animal Frequency by Melissa Alvarez(4442)
Why We Sleep by Matthew Walker(4416)
The Hacking of the American Mind by Robert H. Lustig(4355)
Yoga Anatomy by Kaminoff Leslie(4342)
All Creatures Great and Small by James Herriot(4294)
Double Down (Diary of a Wimpy Kid Book 11) by Jeff Kinney(4252)
Embedded Programming with Modern C++ Cookbook by Igor Viarheichyk(4160)